package cn.com.ethos.search;

import java.io.StringReader;
import java.io.IOException;

import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.Token;
import org.apache.lucene.analysis.TokenStream;

import org.mira.lucene.analysis.IK_CAnalyzer;
/**
 * @author gaoxinzhao
 *
 */
public class Test {

	/**
	 * @param args
	 */
	public static void main(String[] args) {

		String string = new String("我爱中华人民共和国，我爱全世界，我爱全宇宙。i have a rquestion");
		Analyzer analyzer = new IK_CAnalyzer();
		//Analyzer analyzer= new  ChineseAnalyzer ();
	    TokenStream ts = analyzer.tokenStream("dummy",new StringReader(string));
	    Token token;
	    try  {
	      int n=0;
	      while ( (token = ts.next()) != null) {
	        System.out.println((n++)+"->"+token.toString());
	      }
	    }
	    catch(IOException ioe)  {
	      ioe.printStackTrace();
	    }
	}

}
